package com.anthonybennis.blender.client.pages;

import com.anthonybennis.blender.client.Navigatgor;
import com.anthonybennis.blender.client.pages.tipofday.Tip;
import com.anthonybennis.blender.client.pages.tipofday.TipData;
import com.anthonybennis.blender.client.pages.tipofday.TipsFactory;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel;

/**
 * This page appears on start up, to off the user something new.
 */
public class TipOfTheDayPage 
{
	/**
	 * GWT Widget for Tip Of the day.
	 * @return
	 */
	public Widget create(Navigatgor  navigator)
	{
		/*
		 * Get Random Tip
		 */
		TipsFactory factory = new TipsFactory();
		TipData data = factory.createRandomTip();
		Tip tip = new Tip(navigator);
		Widget tipWidget = tip.create(data);
		
		ScrollPanel mainContainer = new ScrollPanel();
		mainContainer.setSize("100%","100%");
		
		mainContainer.add(tipWidget);
		
		return mainContainer;
	}
}